import request from '/@/utils/request';

/**
 * 角色操作接口
 * @method getAdminMenu 获取后端动态路由菜单(admin)
 * @method getTestMenu 获取后端动态路由菜单(test)
 */
export function useTenantApi() {
	return {
		getTenantList: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/tenant/List',
				method: 'get',
				params,
			});
		},
		tenantPageList: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/PageList',
				method: 'post',
				data,
			});
		},
		ownTenantMenuList: (params?: object) => {
			return request<any, AjaxResult>({
				url: '/tenant/OwnMenuList',
				method: 'get',
				params,
			});
		},
		addTenant: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/Add',
				method: 'post',
				data,
			});
		},
		editTenant: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/Update',
				method: 'post',
				data,
			});
		},
		deleteTenant: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/Delete',
				method: 'post',
				data,
			});
		},
		resetTenantPwd: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/ResetPwd',
				method: 'post',
				data,
			});
		},
		changeTenantState: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/SetStatus',
				method: 'post',
				data,
			});
		},
		createTenantDb: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/CreateDb',
				method: 'post',
				data,
			});
		},
		grantTenantMenu: (data={}) => {
			return request<any, AjaxResult>({
				url: '/tenant/GrantMenu',
				method: 'post',
				data,
			});
		},
	};
}
